/**
 * Created by KY on 2017/10/27.
 */
define('comps/loading',['ldfw/core'],function(LDFW){
    let loadingTpl = `
        <div class="weui-toast">
            <i class="weui-loading weui-icon_toast"></i>
            <p class="weui-toast__content">数据加载中</p>
        </div>`
    let LoadingPage = LDFW.Container.extend({
        id:'ld-loading',
        tpl: loadingTpl,
        initialize: function () {
        },
        rendered:function(){
            this.$el.css({display:'none',opacity:0})
        },
        show: function () {
            if(!this.isRendered) {
                this.render()
            }
            if (!$('#ld-loading').length) {
                $('body').append(this.$el)
            }
            this.$el.css({display:'block',opacity:1})
            this.$el.find('.weui-toast').css({opacity: 1,visibility:'visible'})
        },
        hide: function () {
            this.$el.css({display:'none',opacity:0})
            this.$el.find('.weui-toast').css({opacity: 0,visibility:'none'})
        }
    })
    let loadingPage = new LoadingPage()
    return loadingPage
})